package com.own.demo.lwf.threadTest;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @version v1.0
 * @Description:java练习
 * @Author 李文峰
 * @Date 2023/4/30 0030 17:51
 */
public class TestCreatThreadByThreadPool {
    public static void main(String[] args) {
        // 使用工具类Executors创建单线程池
        ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
        // 提交执行任务
        singleThreadExecutor.submit(()-> System.out.println("单线程池执行任务"));
        // 关闭线程池
        singleThreadExecutor.shutdown();
    }
}
